package controller

import (
	"RestaurantApp/service"
	"RestaurantApp/utils"
	"github.com/gin-gonic/gin"
	"strconv"
)

type GoodsController struct {
}

func (this *GoodsController) Routers(r *gin.Engine) {
	goodsGroups := r.Group("/api/good")
	goodsGroups.GET("getGoodsByShopId", this.getGoodsByShopId)

}

func (this *GoodsController) getGoodsByShopId(ctx *gin.Context) {
	id := ctx.Query("shopId")
	shopId, _ := strconv.Atoi(id)
	goodsService := service.GoodsService{}
	shops := goodsService.GetGoodsByShopId(shopId)

	utils.Success(ctx, shops)

}
